using Microsoft.Win32;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace TVSGPP.tools
{
	public class frmAppOptionRetail : Form
	{
		private IContainer components = null;
		private CheckBox ckbSetFocusRetail;
		private Label label1;
		private Button btnSave;
		public GroupBox grB1;
		private Label label2;
		private CheckBox ckbPrintUsage;
		private CheckBox ckbSellWithBill;
		private CheckBox ckbExitAffterPrint;
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
			this.ckbSetFocusRetail = new CheckBox();
			this.grB1 = new GroupBox();
			this.ckbSellWithBill = new CheckBox();
			this.ckbPrintUsage = new CheckBox();
			this.label2 = new Label();
			this.label1 = new Label();
			this.btnSave = new Button();
			this.ckbExitAffterPrint = new CheckBox();
			this.grB1.SuspendLayout();
			base.SuspendLayout();
			this.ckbSetFocusRetail.AutoSize = true;
			this.ckbSetFocusRetail.Font = new Font("Arial", 9f);
			this.ckbSetFocusRetail.Location = new Point(18, 23);
			this.ckbSetFocusRetail.Name = "ckbSetFocusRetail";
			this.ckbSetFocusRetail.Size = new Size(279, 19);
			this.ckbSetFocusRetail.TabIndex = 1;
			this.ckbSetFocusRetail.Text = "Thiết lập chế độ ưu tiên thông tin khi xuất hàng";
			this.ckbSetFocusRetail.UseVisualStyleBackColor = true;
			this.grB1.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.grB1.Controls.Add(this.ckbExitAffterPrint);
			this.grB1.Controls.Add(this.ckbSellWithBill);
			this.grB1.Controls.Add(this.ckbPrintUsage);
			this.grB1.Controls.Add(this.label2);
			this.grB1.Controls.Add(this.label1);
			this.grB1.Controls.Add(this.ckbSetFocusRetail);
			this.grB1.Enabled = false;
			this.grB1.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.grB1.Location = new Point(12, 7);
			this.grB1.Name = "grB1";
			this.grB1.Size = new Size(375, 374);
			this.grB1.TabIndex = 0;
			this.grB1.TabStop = false;
			this.grB1.Text = "Thao tác xuất hàng";
			this.ckbSellWithBill.AutoSize = true;
			this.ckbSellWithBill.Font = new Font("Arial", 9f);
			this.ckbSellWithBill.Location = new Point(18, 107);
			this.ckbSellWithBill.Name = "ckbSellWithBill";
			this.ckbSellWithBill.Size = new Size(232, 19);
			this.ckbSellWithBill.TabIndex = 4;
			this.ckbSellWithBill.Text = "Bán theo đơn theo loại thuốc quy định";
			this.ckbSellWithBill.UseVisualStyleBackColor = true;
			this.ckbPrintUsage.AutoSize = true;
			this.ckbPrintUsage.Font = new Font("Arial", 9f);
			this.ckbPrintUsage.Location = new Point(18, 132);
			this.ckbPrintUsage.Name = "ckbPrintUsage";
			this.ckbPrintUsage.Size = new Size(222, 19);
			this.ckbPrintUsage.TabIndex = 3;
			this.ckbPrintUsage.Text = "In hướng dẫn sử dụng sau hoá đơn";
			this.ckbPrintUsage.UseVisualStyleBackColor = true;
			this.label2.AutoSize = true;
			this.label2.Font = new Font("Arial", 9f);
			this.label2.Location = new Point(74, 81);
			this.label2.Name = "label2";
			this.label2.Size = new Size(233, 15);
			this.label2.TabIndex = 2;
			this.label2.Text = "+ Bỏ Check là ưu tiên thông tin sản phẩm";
			this.label1.AutoSize = true;
			this.label1.Font = new Font("Arial", 9f);
			this.label1.Location = new Point(74, 56);
			this.label1.Name = "label1";
			this.label1.Size = new Size(223, 15);
			this.label1.TabIndex = 1;
			this.label1.Text = "+ Check là ưu tiên thông tin khách hàng";
			this.btnSave.Cursor = Cursors.Hand;
			this.btnSave.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnSave.Location = new Point(12, 387);
			this.btnSave.Name = "btnSave";
			this.btnSave.Size = new Size(90, 30);
			this.btnSave.TabIndex = 11;
			this.btnSave.Text = "Ghi nhận";
			this.btnSave.UseVisualStyleBackColor = true;
			this.btnSave.Click += new EventHandler(this.btnSave_Click);
			this.ckbExitAffterPrint.AutoSize = true;
			this.ckbExitAffterPrint.Font = new Font("Arial", 9f);
			this.ckbExitAffterPrint.Location = new Point(18, 157);
			this.ckbExitAffterPrint.Name = "ckbExitAffterPrint";
			this.ckbExitAffterPrint.Size = new Size(222, 19);
			this.ckbExitAffterPrint.TabIndex = 5;
			this.ckbExitAffterPrint.Text = "In hướng dẫn sử dụng sau hoá đơn";
			this.ckbExitAffterPrint.UseVisualStyleBackColor = true;
			base.AutoScaleDimensions = new SizeF(7f, 15f);
			//base.AutoScaleMode = AutoScaleMode.Font;
			this.BackColor = Color.White;
			base.ClientSize = new Size(399, 427);
			base.Controls.Add(this.btnSave);
			base.Controls.Add(this.grB1);
			this.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			//base.Icon = (System.Drawing.Icon)componentResourceManager.GetObject("$this.Icon");
			base.Name = "frmAppOptionRetail";
			base.StartPosition = FormStartPosition.CenterScreen;
			this.Text = "Tuỳ biến giao diện";
			base.Load += new EventHandler(this.frmAppOptionMain_Load);
			this.grB1.ResumeLayout(false);
			this.grB1.PerformLayout();
			base.ResumeLayout(false);
		}
		public frmAppOptionRetail()
		{
			this.InitializeComponent();
		}
		private void btnSave_Click(object sender, EventArgs e)
		{
			try
			{
				RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software\\TVSGPP", true);
				if (this.grB1.Enabled)
				{
					registryKey.SetValue("SetFocusRetail", this.ckbSetFocusRetail.Checked.ToString());
					registryKey.SetValue("PrintUsage", this.ckbPrintUsage.Checked.ToString());
					registryKey.SetValue("SellWithBill", this.ckbSellWithBill.Checked.ToString());
					registryKey.SetValue("ExitAffterPrint", this.ckbExitAffterPrint.Checked.ToString());
				}
				registryKey.Close();
				MessageBox.Show("Dữ liệu đã được cập nhật vào hệ thống!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}
		private void frmAppOptionMain_Load(object sender, EventArgs e)
		{
			try
			{
				RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software\\TVSGPP", true);
				if (this.grB1.Enabled)
				{
					this.ckbSetFocusRetail.Checked = bool.Parse(registryKey.GetValue("SetFocusRetail").ToString());
					this.ckbPrintUsage.Checked = bool.Parse(registryKey.GetValue("PrintUsage").ToString());
					this.ckbSellWithBill.Checked = bool.Parse(registryKey.GetValue("SellWithBill").ToString());
					this.ckbExitAffterPrint.Checked = bool.Parse(registryKey.GetValue("ExitAffterPrint").ToString());
				}
				registryKey.Close();
			}
			catch
			{
			}
		}
	}
}
